"use strict";
cc._RF.push(module, '77e4agyf8VG2qZm4T802A+9', 'PeopleArcheryGetMoneyPage');
// scripts/Game/Page/PeopleArcheryGetMoneyPage.ts

"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var gameEngine_1 = require("../../engines/gameEngine");
var PageBase_1 = require("../Base/PageBase");
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var PeopleArcheryGetMoneyPage = /** @class */ (function (_super) {
    __extends(PeopleArcheryGetMoneyPage, _super);
    function PeopleArcheryGetMoneyPage() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.lbNum = null;
        _this.level = null;
        _this.moneyNum = 0;
        _this.completeFun = null;
        return _this;
    }
    PeopleArcheryGetMoneyPage.prototype.bindLevel = function (level, moneyNum, complteFun) {
        this.level = level;
        this.moneyNum = moneyNum;
        this.completeFun = complteFun;
        this.refrenshPage();
    };
    PeopleArcheryGetMoneyPage.prototype.refrenshPage = function () {
        this.lbNum.string = (this.moneyNum + (this.moneyNum * this.level.role.goldAddition)).toString();
    };
    PeopleArcheryGetMoneyPage.prototype.onBtnGet = function () {
        var addition = this.level.role.goldAddition * this.moneyNum;
        var realMoney = this.moneyNum + addition;
        console.log(realMoney, "真实的钱");
        gameEngine_1.default.getManagers().peopleArcheryManager.setData({ money: realMoney });
        this.ClosePage();
        this.completeFun && this.completeFun();
    };
    PeopleArcheryGetMoneyPage.prototype.onBtnDouble = function () {
        var _this = this;
        var addition = this.moneyNum * 2 * this.level.role.goldAddition;
        var realMoney = this.moneyNum * 2 + addition;
        console.log(realMoney, "真实的钱");
        if (gameEngine_1.default.getServices().userSrv.getCoins() > 0) {
            gameEngine_1.default.getManagers().peopleArcheryManager.setData({ money: realMoney });
            this.ClosePage();
            this.completeFun && this.completeFun();
        }
        else {
            gameEngine_1.default.getServices().miniGameSrv.getAppApiInstance().loadAndShowVideoAd(function () {
                gameEngine_1.default.getManagers().peopleArcheryManager.setData({ money: realMoney });
                _this.ClosePage();
                _this.completeFun && _this.completeFun();
            }, function () { }, null, "看广告获得双倍修为");
        }
    };
    __decorate([
        property({ type: cc.Label, tooltip: "金币数量文本" })
    ], PeopleArcheryGetMoneyPage.prototype, "lbNum", void 0);
    PeopleArcheryGetMoneyPage = __decorate([
        ccclass
    ], PeopleArcheryGetMoneyPage);
    return PeopleArcheryGetMoneyPage;
}(PageBase_1.default));
exports.default = PeopleArcheryGetMoneyPage;

cc._RF.pop();